// Copyright (c) 2010 School of Software, Tsinghua University, Beijing (China)
// All rights reserved.
//
// This file is part of Geoxiom (http://code.google.com/p/geoxiom/); you may 
// redistribute it under the terms of the GNU Lesser General Public License.
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Author(s) : Kan-Le Shi

#ifndef GEOXIOM_GRAMMAR_PATTERN_HPP
#define GEOXIOM_GRAMMAR_PATTERN_HPP

#include "wildcard.hpp"

namespace Geoxiom {
namespace Grammar {

typedef class Pattern {
private:
	typedef Geoxiom::Lex::Stream Stream;

protected:
	Stream template_;
	PatternType type_;

	std::vector<Wildcard> wildcards_;
	
protected:
	void analyze_wildcards() {
		wildcards_.clear();

		// analyse the template_ stream, and filter out 
		// wildcards, fill it into the wildcards_ structure.
		// and modify template_ stream, using wildcard element.

		throw "not implemented";
	}

public:
	void set(const Stream &stream, const PatternType &type) {
		type_ = type;
		template_ = stream;
		analyze_wildcards();
	};
	PatternType get_type() const { return type_; }

	static Pattern* load(const std::string filename) {
		// load pattern from file
		throw "not implemented";
	}
	
public:
	Pattern() : template_(), type_(), wildcards_() { }
	~Pattern() { }

} *PatternPtr, *PatternArray;

}
}

#endif